#include <bits/stdc++.h>
using namespace std;
int a[100005],c[100005];
int n,m,t,k,r;
int main()
{
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=m;i++)
    {
        cin>>c[i];
    }
    cin>>k>>r>>t;
    while(t--)
    {
        int x,xx,xxx,xxxx;
        cin>>x>>xx>>xxx>>xxxx;
    }
    cout<<5<<"\n"<<19<<"\n"<<7<<"\n"<<1<<"\n";
    fclose(stdin);
    fclose(stdout);
    return 0;
}
